import argparse

parser = argparse.ArgumentParser()
parser.add_argument('row')
parser.add_argument('col')
args = parser.parse_args()
row = eval(args.row)
col = eval(args.col)
l=[]
for i in range(row):
    l_row = []
    for j in range(col // 2):
        l_row += [j * (2 * row)+ i + 1, j * (2 * row)+ i + 2*(row-i )]
    l.append(l_row)

if row % 2 == 1:
    for i,l_row in enumerate(l):
        l_row.append(row *(col - 1 )+ 1 + i)

for i in l:
    print(*i)